package com.twentytwok.hospitalsystem22K.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class R2 {
    private Integer code;
    private String msg;
    private Object result;

    public static R2 ok(Integer code,String msg){
        return new R2(code,msg);
    }

    public static R2 ok(Integer code,String msg,Object result){
        return new R2(code,msg,result);
    }

    public static R2 ok(Integer code){
        return new R2(code,"ok");
    }

    public static R2 error(Integer code){
        return new R2(code,"error");
    }

    public static R2 error(Integer code,String msg){
        return new R2(code,msg);
    }

    public R2(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
